package com.buttonpay.home;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView; 
import com.buttonpay.R;

public class TransactionDetailsActivity extends Activity
{
	Context context;
	Button btnBack,btnLogout;
	Bundle bundle;
	TextView tv_productName,tv_requestTime,tv_topupValue,tv_referenceNumber,tv_transactionSummary;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState); 
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.transaction_detils_popup);
		TextView tveaderText = (TextView)findViewById(R.id.tv_headerText);
		 tveaderText.setText("Transaction Details");
		tv_productName=(TextView)findViewById(R.id.tv_productName);
		tv_referenceNumber=(TextView)findViewById(R.id.tv_referenceNumber);
		tv_requestTime=(TextView)findViewById(R.id.tv_requestTime);
		tv_topupValue=(TextView)findViewById(R.id.tv_topupValue);
		tv_transactionSummary=(TextView)findViewById(R.id.tv_transactionSummary);
		
        btnBack=(Button)findViewById(R.id.btnPrevious);
        btnLogout=(Button)findViewById(R.id.btnLogout);
        
        bundle=getIntent().getExtras();
        tv_productName.setText(bundle.getString("productname"));
        tv_referenceNumber.setText(bundle.getString("referencenumber"));  
        tv_requestTime.setText(bundle.getString("requesttime"));
        tv_topupValue.setText(bundle.getString("topupvalue"));
        tv_transactionSummary.setText(bundle.getString("transactionsummary"));
         
        btnBack.setOnClickListener(new OnClickListener()
		{
			
			public void onClick(View arg0) 
			{
				// TODO Auto-generated method stub
				finish();
			}
			
		});
		
		btnLogout.setOnClickListener(new OnClickListener()
		{
			
			public void onClick(View v) 
			{
				new AlertDialog.Builder(TransactionDetailsActivity.this)
		        .setTitle( "Exit Application" )
		        .setMessage( "Are you sure you want to Logout?" )
		        .setPositiveButton("YES", new android.content.DialogInterface.OnClickListener() 
		        {
		            public void onClick(DialogInterface arg0, int arg1) 
		            {
		                //do stuff onclick of YES
		            	setResult(22);
		            	finish();
		            }

					public void onClick(View v) 
					{
						// TODO Auto-generated method stub
						
					}
		        })
		        .setNegativeButton("NO",  new android.content.DialogInterface.OnClickListener() {
		            public void onClick(DialogInterface arg0, int arg1)
		            {
		                //do stuff onclick of CANCEL
		            	arg0.dismiss();
		               
		            }

					public void onClick(View v) 
					{
						// TODO Auto-generated method stub
					}
		        }).show();
				  		
			}
		});
             
	}
	 
}
